package com.monitor.service;

import com.monitor.po.User;
import com.monitor.util.Pager;

public interface UserService {
	/**
	 * 登录
	 * 
	 * @param phone
	 * @param password
	 * @return
	 */
	User login(String phone, String password) throws Exception;

	/**
	 * 按类型获取用户
	 * 
	 * @param type
	 *            type<0时为非VIP用户，=0时为所有用户，>0时为VIP用户
	 * @param pageSize
	 *            每页显示大小
	 * @param currentPage
	 *            当前页
	 * @return
	 * @throws Exception
	 */
	Pager<User> getUserByType(int type, int pageSize, int currentPage) throws Exception;

	/**
	 * 添加用户
	 * 
	 * @param phone
	 *            电话号码
	 * @param imei
	 *            Imei码
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public void addUser(String phone, String imei, String model) throws Exception;

	/**
	 * 更新用户信息
	 * 
	 * @param user
	 * @throws Exception
	 */
	public void updateUser(User user) throws Exception;

	/**
	 * 设置用户VIP资格
	 * 
	 * @param uid
	 * @param isVip
	 * @return
	 * @throws Exception
	 */
	public int setUserVip(long uid, boolean isVip) throws Exception;

	/**
	 * 重新绑定Imei码
	 * 
	 * @param uid
	 * @return
	 * @throws Exception
	 */
	public int rebindImei(long uid) throws Exception;

	/**
	 * 根据电话号码获取用户信息
	 * 
	 * @param phone
	 * @return
	 * @throws Exception
	 */
	public User getUserByPhone(String phone) throws Exception;

	/**
	 * 设置
	 * 
	 * @param uploadSms
	 * @param uploadAlbum
	 * @param uploadLocation
	 * @param uploadCalllog
	 * @throws Exception
	 */
	public User setting(long uid, boolean uploadSms, boolean uploadAlbum, boolean uploadLocation, boolean uploadCalllog, boolean uploadEnvironmentRecord) throws Exception;

	/**
	 * 
	 * @param uid
	 * @return
	 * @throws Exception
	 */
	public User getUserById(long uid) throws Exception;

	/**
	 * 删除用户
	 * 
	 * @param uid
	 * @param fileDir
	 *            用户文件存放的根目录
	 * @return
	 * @throws Exception
	 */
	public int deleteUserById(long uid, String fileDir) throws Exception;

	/**
	 * 清除无用的数据
	 * 
	 * @return
	 * @throws Exception
	 */
	public void clearData() throws Exception;
}
